/*
 * @(#)ElasticSearchConfig.java
 * Date 2013-04-09
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.ihecommon.config;

import us.hornerscorners.lamppost.model.common.PersistableModelType;

import static us.hornerscorners.lamppost.model.common.PersistableModelType
    .DocumentContent;
import static us.hornerscorners.lamppost.model.common.PersistableModelType.DocumentEntry;
import static us.hornerscorners.lamppost.model.common.PersistableModelType.Folder;
import static us.hornerscorners.lamppost.model.common.PersistableModelType.Patient;
import static us.hornerscorners.lamppost.model.common.PersistableModelType
    .PatientIdentity;
import static us.hornerscorners.lamppost.model.common.PersistableModelType.SubmissionSet;


/**
 * Class description
 *
 *
 * @version        v1.0, 2013-04-09
 * @author         Jim Horner
 */
public class ElasticSearchConfig implements IDataStoreConfig {

    /** Field description */
    private String auditEventType;

    /** Field description */
    private String documentContentType;

    /** Field description */
    private String documentEntryType;

    /** Field description */
    private String folderType;

    /** Field description */
    private String hostName;

    /** Field description */
    private String indexName;

    /** Field description */
    private String patientIdentityType;

    /** Field description */
    private String patientType;

    /** Field description */
    private int port;

    /** Field description */
    private String submissionSetType;

    /**
     * Constructs ...
     *
     */
    public ElasticSearchConfig() {
        super();
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public String getAuditEventTable() {
        return this.auditEventType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getAuditEventType() {
        return auditEventType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public String getDatabaseName() {
        return this.indexName;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public String getDocumentContentTable() {
        return this.documentContentType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getDocumentContentType() {
        return documentContentType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public String getDocumentEntryTable() {
        return this.documentEntryType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getDocumentEntryType() {
        return documentEntryType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public String getFolderTable() {
        return this.folderType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getFolderType() {
        return folderType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public String getHostName() {
        return hostName;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getIndexName() {
        return indexName;
    }

    /**
     * Method description
     *
     *
     *
     * @param modelClass
     * @return
     */
    public String getModelType(Class modelClass) {

        PersistableModelType type =
            PersistableModelType.toPersistableModelType(modelClass);

        return getModelType(type);
    }

    /**
     * Method description
     *
     *
     * @param type
     *
     * @return
     */
    public String getModelType(PersistableModelType type) {

        String result = null;

        switch (type) {

            case AuditEvent :
                result = this.auditEventType;

                break;

            case DocumentContent :
                result = this.documentContentType;

                break;

            case DocumentEntry :
                result = this.documentEntryType;

                break;

            case Folder :
                result = this.folderType;

                break;

            case Patient :
                result = this.patientType;

                break;

            case PatientIdentity :
                result = this.patientIdentityType;

                break;

            case SubmissionSet :
                result = this.submissionSetType;

                break;

            default :
                throw new IllegalArgumentException("Unknown PersistableType.");
        }

        return result;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public String getPatientIdentityTable() {
        return this.patientIdentityType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getPatientIdentityType() {
        return this.patientIdentityType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public String getPatientTable() {
        return this.patientType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getPatientType() {
        return patientType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public int getPort() {
        return port;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public String getSubmissionSetTable() {
        return this.submissionSetType;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getSubmissionSetType() {
        return submissionSetType;
    }

    /**
     * Method description
     *
     *
     * @param auditEventType
     */
    public void setAuditEventType(String auditEventType) {
        this.auditEventType = auditEventType;
    }

    /**
     * Method description
     *
     *
     * @param documentContentType
     */
    public void setDocumentContentType(String documentContentType) {
        this.documentContentType = documentContentType;
    }

    /**
     * Method description
     *
     *
     * @param documentEntryType
     */
    public void setDocumentEntryType(String documentEntryType) {
        this.documentEntryType = documentEntryType;
    }

    /**
     * Method description
     *
     *
     * @param folderType
     */
    public void setFolderType(String folderType) {
        this.folderType = folderType;
    }

    /**
     * Method description
     *
     *
     * @param hostName
     */
    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    /**
     * Method description
     *
     *
     * @param indexName
     */
    public void setIndexName(String indexName) {
        this.indexName = indexName;
    }

    /**
     * Method description
     *
     *
     * @param patientIdentityType
     */
    public void setPatientIdentityType(String patientIdentityType) {
        this.patientIdentityType = patientIdentityType;
    }

    /**
     * Method description
     *
     *
     * @param patientType
     */
    public void setPatientType(String patientType) {
        this.patientType = patientType;
    }

    /**
     * Method description
     *
     *
     * @param port
     */
    public void setPort(int port) {
        this.port = port;
    }

    /**
     * Method description
     *
     *
     * @param submissionSetType
     */
    public void setSubmissionSetType(String submissionSetType) {
        this.submissionSetType = submissionSetType;
    }
}
